<template>
	<view class="content">
		<view style="height: 1rpx;"></view>
		<view class="addAccount" @click="toAddAccount" v-show="accountList.length<2">
			<span>添加账户</span>
			<image src="@/subpageA/static/img/my_slices/assets/Group231.png" mode="scaleToFill"></image>
		</view>
		<view class="account" v-for="item,index in accountList" :key="index">
			<view class="left">
				<image  v-if="item.provider=='weixin'" src="@/subpageA/static/img/my_slices/assets/weixinPic.png" alt="" mode="scaleToFill"></image>
				<image v-if="item.provider=='zhifubao'" src="@/subpageA/static/img/my_slices/assets/Frame@2x-3.png" alt="" mode="scaleToFill"></image>
				<view class="name">
					<span>{{item.account}}</span>
					<span>{{item.name}}</span>
				</view>
			</view>
			<view class="right" @click="accountDelete(index)">
				<span>移除</span>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				accountList:[{
					provider:'weixin',
					name:'sss',
					account:'sssssss'
				}]
			}
		},
		onLoad() {
			this.$bus.$on('addAccount',account=>{
				let temp={
					provider:'zhifubao',
					account:account.account,
					name:account.name
				}
				this.accountList.push(temp);
			})
		},
		methods: {
			toAddAccount(){
				uni.navigateTo({
					url:'./addAccount'
				})
			},
			accountDelete(index){
				this.accountList.splice(index,1)
			}
		}
	}
</script>

<style scoped lang="scss">
	.content{
		width: 100%;
		min-height: 100vh;
		background-color: #FFFFFF;
		
		.addAccount{
			width: 622rpx;
			padding:0 32rpx;
			margin: 32rpx;
			height: 112rpx;
			background: #FFFFFF;
			box-shadow: 0px 4rpx 24rpx 0px rgba(0,0,0,0.08);
			border-radius: 16rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			
			>span{
				font-size: 14px;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #99A3A3;
			}
			>image{
				width: 48rpx;
				height: 48rpx;
			}
		}
		
		.account{
			width: 622rpx;
			height: 152rpx;
			padding:0 32rpx;
			margin: 32rpx;
			background: #FFFFFF;
			box-shadow: 0px 2px 12px 0px rgba(0,0,0,0.08);
			border-radius: 16rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			
			.left{
				display: flex;
				align-items: center;
				image{
					width: 72rpx;
					height: 72rpx;
				}
				.name{
					margin-left: 10rpx;
					span:nth-of-type(1){
						display: block;
						font-size: 28rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #001A18;
					}
					span:nth-of-type(2){
						display: block;
						font-size: 24rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #99A3A3;
					}
				}
			}
		
			.right{
				span{
					font-size: 24rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #FF5F58;
				}
			}
		
		}
	}
</style>
